import os
import time
import xlrd

def GetTestDataPath():
    ospath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    return os.path.join(ospath, "data", "TestData.xls")


def GetTestReport():
    now = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime(time.time()))
    ospath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    return os.path.join(ospath,  "reports", now+"TestReport.xlsx")

def GetTestReportHtml():
    now = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime(time.time()))
    ospath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    return os.path.join(ospath,  "reports",  now+"TestReport.html")

def GetTestLogPath():
    now = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime(time.time()))
    ospath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    return os.path.join(ospath, "logs",now+"test.log")


def GetTestConfig(configname):
    ospath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    return os.path.join(ospath, "config", configname)

# 读取测试数据
Testdata = xlrd.open_workbook(GetTestDataPath())
# 选择excle表中的sheet
table = Testdata.sheets()[0]
# 从测试数据中读取url
hurl = table.cell(0, 1).value
print(hurl)
